/**
 * @author zhengjiachao
 * @since 2017-3-27
 */
BCP.bill.model.ButtonModel = function(){
    BCP.bill.model.ButtonModel.superclass.constructor.call(this);
};

BCP.bill.model.ButtonModel.PROPERTY_BINDING="binding";
BCP.bill.model.ButtonModel.PROPERTY_ACTION_BINDING="action_binding";

COM.util.defineClass(BCP.bill.model.ButtonModel, ADF.model.ButtonModel, {

    initModel:function(){
        BCP.bill.model.ButtonModel.superclass.initModel.call(this);
        this.addPropertyDescriptor(new BCP.bill.propertyDescriptor.BindingPropertyDescriptor(BCP.bill.model.ButtonModel.PROPERTY_BINDING,"","",true, "绑定"));
        this.addPropertyDescriptor(new ADF.propertyDescriptor.DefaultPropertyDescriptor(BCP.bill.model.ButtonModel.PROPERTY_ACTION_BINDING,"","",true, "动作绑定"));
    },
    setBinding:function (binding) {
        this.setPropertyValue(BCP.bill.model.ButtonModel.PROPERTY_BINDING,binding);
    },
    getBinding:function () {
        return this.getPropertyValue(BCP.bill.model.ButtonModel.PROPERTY_BINDING);
    },

    setActionBinding:function (binding) {
        this.setPropertyValue(BCP.bill.model.ButtonModel.PROPERTY_ACTION_BINDING,binding);
    },
    getActionBinding:function () {
        return this.getPropertyValue(BCP.bill.model.ButtonModel.PROPERTY_ACTION_BINDING);
    },

    _getModelType : function(){
        return "BCP.bill.model.ButtonModel";
    },

    fillSerializedJson : function(jsonObject){
        BCP.bill.model.ButtonModel.superclass.fillSerializedJson.call(this, jsonObject);
        jsonObject[BCP.bill.model.ButtonModel.PROPERTY_BINDING]=this.getPropertyDescriptor(BCP.bill.model.ButtonModel.PROPERTY_BINDING).serialize();
        jsonObject[BCP.bill.model.ButtonModel.PROPERTY_ACTION_BINDING]=this.getPropertyDescriptor(BCP.bill.model.ButtonModel.PROPERTY_ACTION_BINDING).serialize();
    },

    _deserialize:function (jsonObject) {
        BCP.bill.model.ButtonModel.superclass._deserialize.call(this,jsonObject);
        var newProp=new AGEF.PropertyDescriptor();
        newProp.deserialize(jsonObject[BCP.bill.model.ButtonModel.PROPERTY_BINDING]);
        this.propertyDescriptors.put(newProp.getName(),newProp);
        newProp=new AGEF.PropertyDescriptor();
        newProp.deserialize(jsonObject[BCP.bill.model.ButtonModel.PROPERTY_ACTION_BINDING]);
        this.propertyDescriptors.put(newProp.getName(),newProp);
    }

});